<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>2_1_2-2-动态指令参数</title>
</head>

<body>


  <!--载入vue.js-->
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>

  <div id="Application" style="text-align: center">
    <h1 v-bind:[prop]="name" v-if="show">标题</h1>
  </div>

  <script>
    const App = {
      data() {
        return {
          show: true,
          prop: "class",
          name: "h1",
        };
      },
    };
    Vue.createApp(App).mount("#Application");
  </script>

  <style>
    #h1 {
      color: red;
    }

    .h1 {
      color: blue;
    }
  </style>
</body>

</html>